﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AForge.Video.DirectShow;

namespace video_ai_2
{
    public partial class SelectCaptureDevice : Form
    {
        FilterInfoCollection videoDevices;
        private string device;

        // Video device
        public string VideoDevice
        {
            get { return device; }
        }
        public SelectCaptureDevice()
        {
            InitializeComponent();

            // show device list
            try
            {
                // enumerate video devices
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

                if (videoDevices.Count == 0)
                    throw new ApplicationException();

                // add all devices to combo
                foreach (FilterInfo device in videoDevices)
                {
                    comboBoxDevice.Items.Add(device.Name);
                }
            }
            catch (ApplicationException)
            {
                comboBoxDevice.Items.Add("Нет записывающих устройств.");
                comboBoxDevice.Enabled = false;
                ok.Enabled = false;
            }

            comboBoxDevice.SelectedIndex = 0;
        }

        private void ok_Click(object sender, EventArgs e)
        {

        }

        private void cancel_Click(object sender, EventArgs e)
        {

        }
    }
}
